<template>
	<view @click="clickFillRecordItem" class="fill-record-item">
		<view class="title">
			<view class="title-text">{{ data.pmName }}</view>
		</view>

		<view class="box-con">
			<view class="box-item">线路名称：{{ data.lineSiteList[0].name }}</view>
			<view class="box-item">区间站点：{{ extractLowestLevelList(data.lineSiteList).map(it => it.name).join(",") }}</view>
			<view class="box-item">开始时间：{{ getDate2(data.constructionStartTime) }}</view>
			<view class="box-item">提交人员：{{ data.creatorUserName }}</view>
		</view>
	</view>
</template>

<script>
	import mixins from "@/utils/mixins.js"
	import { constructionPlan_delete, constructionPlan_get } from "@/api/engineeringMaintenance/engineeringMaintenance.js";
	export default {
		name: "fill-record-item",
		mixins: [mixins],
		props: {
			/**
			 * 当前组件的类型 
			 * 参考蓝湖地址：https://lanhuapp.com/web/#/item/project/detailDetach?pid=78dfd8f8-40b8-45cc-8521-66aa786384ea&project_id=78dfd8f8-40b8-45cc-8521-66aa786384ea&image_id=8c16eb70-0af1-4b84-81cc-3690028a1985&fromEditor=true
			 * - 0: 没有上传照片按钮的那种  1: 已上传的那种  2: 未上传的那种
			 * */
			type: {
				type: Number,
				default: 0
			},
			/** 数据 */
			data: {
				type: Object,
				default: () => ({}),
			},
			/** 页面的类型 - 0: 综合大修下的  1: 工程维保下的 */
			pageType: {
				type: Number,
				default: 0
			},
		},
		data() {
			return {
				isLoading: false,
			}
		},
		methods: {
			/** 点击某一项 */
			clickFillRecordItem() {
				uni.navigateTo({
					url: `/subpackage-plasmosafety/pages/qualitySafetyManagement/dailyConstructionPlan/planDetails?id=${this.data.id}&state=cancel`
				});
			},
			//获取树形数据最后一个list
			extractLowestLevelList(data) {
				let result = [];
				for (let i = 0; i < data.length; i++) {
					if (data[i].list) {
						result = result.concat(this.extractLowestLevelList(data[i].list));
					} else {
						result.push(data[i]);
					}
				}
				return result;
			},
		}
	}
</script>

<style scoped lang="scss">
	.fill-record-item {
		background: #fff;
		// border-radius: 20upx;
		padding: 20upx 26upx;
		border-bottom: 2rpx solid #E0E7F6;

		.title {
			color: #22204e;
			font-weight: bold;
			display: flex;
			justify-content: space-between;
			align-items: center;

			.title-text {
				line-height: 40upx;
				max-width: 700upx;
				white-space: nowrap;
				overflow: hidden;
				text-overflow: ellipsis;
			}
		}

		.box-con {
			margin-top: 16upx;
			line-height: 28upx;
			font-size: 28upx;
			color: #6a819e;

			.box-item {
				margin-left: 4upx;
				margin-top: 16upx;
				line-height: 28upx;
				max-width: 700upx;
				white-space: nowrap;
				overflow: hidden;
				text-overflow: ellipsis;
			}
		}
		.btn-op {
			display: flex;
			align-items: center;
			justify-content: flex-end;
			margin-top: 10upx;
			.op-red, .op-blue, .op-yellow{
				width: 128upx;
				height: 60upx;
				background: #FF6A6A;
				border-radius: 8upx;
				text-align: center;
				color: white;
				font-size: 28upx;
				font-weight: 500;
				line-height: 60upx;
			}
			.op-yellow {
				background: #f59a23;
			}
			.op-blue {
				background: #2F80ED;
				margin:0 20upx;
			}
		}


	}
</style>